package gob.pe.mtpe.ibatis.comun;

import com.ibatis.common.resources.Resources;
import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.DaoManagerBuilder;
import java.sql.SQLException;

public class DaoConfig {
  private static final DaoManager daoManager;
  static{
      try {daoManager = DaoManagerBuilder.buildDaoManager(Resources.getResourceAsReader("gob/pe/mtpe/ibatis/config/dao.xml"));
          } catch (Exception e) {      	
    	    e.printStackTrace();
            throw new RuntimeException("ERROR :>>>>>>>> NO SE PEUDE INICIALIZAR LA CONEXION  CAUSA  :" + e);
    }   
  }

  public static DaoManager getDaomanager() {
    return daoManager;
  }

  public void startTransaction () throws SQLException{
	daoManager.startTransaction();
  }

  public void commitTransaction () throws SQLException{
  	daoManager.commitTransaction();
  }

  public void endTransaction () throws SQLException{}{
  	daoManager.endTransaction();
  }  
  
}
